home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Graphics / sKulpt / skulpt-src / Ami-Demo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-30  |  3.1 KB  |  108 lines

  1. #define STRICT
  2.  
  3. // Includes standard Windows
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include <time.h>
  7. #include <stdlib.h>
  8. #include <malloc.h>
  9. #include <memory.h>
  10. #include <stdio.h>
  11.  
  12. // Includes D3D
  13. #define  D3D_OVERLOADS
  14. #include <ddraw.h>
  15. #include <d3d.h>
  16. #include <d3dx.h>
  17.  
  18. // Includes utilitaires D3D
  19. #include "d3dmath.h"
  20. #include "d3dutil.h"
  21. #include "D3DEnum.h"
  22.  
  23. // Ids Resources
  24. #include "resource.h"
  25.  
  26. // Constantes
  27. #include "const.h"
  28.  
  29. // Types
  30. #include "types.h"
  31.  
  32. // Variables globales projet
  33. #include "vars.h"
  34.  
  35. // Prototypes fonctions autres modules
  36. #include "proto.h"
  37.  
  38. // Macros
  39. #include "macros.h"
  40.  
  41. void vDemo(void)
  42. {
  43.     struct DateStamp sDS1, sDS2;
  44.  
  45.     vDeleteObjects();
  46.  
  47.     DateStamp(&sDS1);
  48.  
  49.     D3DVECTOR   v1 = D3DVECTOR( -1.,    -1.,    -1.);   // u : 0    v : 0
  50.     D3DVECTOR   v2 = D3DVECTOR(  1.,    -1.,    -1.);   // u : 127  v : 0
  51.     D3DVECTOR   v3 = D3DVECTOR(  1.,     1.,    -1.);   // u : 127  v : 127
  52.     D3DVECTOR   v4 = D3DVECTOR( -1.,     1.,    -1.);   // u : 0    v : 127
  53.  
  54.     D3DVECTOR   v5 = D3DVECTOR( -1.,    -1.,     1.);   // u : 0    v : 0
  55.     D3DVECTOR   v6 = D3DVECTOR(  1.,    -1.,     1.);   // u : 127  v : 0
  56.     D3DVECTOR   v7 = D3DVECTOR(  1.,     1.,     1.);   // u : 127  v : 127
  57.     D3DVECTOR   v8 = D3DVECTOR( -1.,     1.,     1.);   // u : 0    v : 127
  58.  
  59.     int         i1 = iMakeVertex(v1, XDC_FORCENEW);
  60.     int         i2 = iMakeVertex(v2, XDC_FORCENEW);
  61.     int         i3 = iMakeVertex(v3, XDC_FORCENEW);
  62.     int         i4 = iMakeVertex(v4, XDC_FORCENEW);
  63.     int         i5 = iMakeVertex(v5, XDC_FORCENEW);
  64.     int         i6 = iMakeVertex(v6, XDC_FORCENEW);
  65.     int         i7 = iMakeVertex(v7, XDC_FORCENEW);
  66.     int         i8 = iMakeVertex(v8, XDC_FORCENEW);
  67.  
  68.     int         t1 = iMakeTriangle(i1, i2, i3, 0); bSetUV(t1, 0, 0, 127, 0, 127, 127);
  69.     int         t2 = iMakeTriangle(i1, i3, i4, 0); bSetUV(t2, 0, 0, 127, 127, 0, 127);
  70.     int         t3 = iMakeTriangle(i5, i6, i7, 0); bSetUV(t3, 0, 0, 127, 0, 127, 127);
  71.     int         t4 = iMakeTriangle(i5, i7, i8, 0); bSetUV(t4, 0, 0, 127, 127, 0, 127);
  72.  
  73.     Materials[0].bTextured = TRUE;
  74.  
  75.     for (float fAlpha = 0 ; fAlpha < 2. * 2. * g_PI ; fAlpha += g_PI / 90.)
  76.     {
  77.         Observer.x = 9. * sin(fAlpha / 1.5);
  78.         Observer.z = 9. * sin(fAlpha);
  79.         Observer.y = 9. * cos(fAlpha);
  80.  
  81.         D3DUtil_SetViewMatrix(matView,
  82.                   Observer,    // From
  83.                   Target,    // To
  84.                   Target);
  85.  
  86.         // Redessiner la scène 3D
  87.         vForce3DRefresh(XDC_MODE_COMPLET);
  88.     }
  89.     DateStamp(&sDS2);
  90.     if (sDS2.ds_Tick < sDS1.ds_Tick) sDS2.ds_Tick += 3000;
  91.     vTrace("Temps écoulé : %f s", (sDS2.ds_Tick - sDS1.ds_Tick) / 50.);
  92.  
  93.     // Redessiner la scène 2D
  94.     vForce2DRefresh(XDC_MODE_COMPLET);
  95.  
  96. /*
  97.     int         t5 = iMakeTriangle(i1, i2, i3, 0);
  98.     int         t6 = iMakeTriangle(i1, i2, i3, 0);
  99.     int         t7 = iMakeTriangle(i1, i2, i3, 0);
  100.     int         t8 = iMakeTriangle(i1, i2, i3, 0);
  101.     int         t9 = iMakeTriangle(i1, i2, i3, 0);
  102.     int        t10 = iMakeTriangle(i1, i2, i3, 0);
  103.     int        t11 = iMakeTriangle(i1, i2, i3, 0);
  104.     int        t12 = iMakeTriangle(i1, i2, i3, 0);
  105. */
  106. }
  107.  
  108.